import Admin from '../pages/Admin'
const Login = () => import('../pages/Login')

const routes = [
  {
    path: '/',
    redirect: '/login', // redirect，要重定向的路由路径
  },
  {
    path: '/',
    element: <Admin/>, 
    children:[
      {
        path:'dashboard',
        component:()=>import('../pages/Admin/Dashboard'),
        meta:{
          needLogin:true
        }
      },
      {
        path:'file',
        meta:{
          title:'文章管理',
          needLogin:true
        },
        children:[
          {
            path:'write',
            component:()=>import('../pages/Admin/Write'),
            meta:{
              needLogin:true
            }
          },
          {
            path:'fileList',
            component:()=>import('../pages/Admin/FileList'),
            meta:{
              needLogin:true
            }
          },
        ]
      },
      {
        path:'category',
        component:()=>import('../pages/Admin/Category'),
        meta:{
          needLogin:true
        }
      },
      {
        path:'users',
        component:()=>import('../pages/Admin/Users'),
        meta:{
          needLogin:true
        }
      },
      
    ],
    meta: { // meta，自定义的数据
      title: '管理页面',
      needLogin: true,
    },
  },
  {
    path: '/login',
    component:Login, // component，懒加载方式引入的组件
    meta: { // meta，自定义的数据
      title: '登录页面',
      needLogin: false,
    },
  },
]
export default routes